<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
      <script type="text/javascript" src="jquery.js"></script>
    <title>Document</title>
</head>

<body>
<canvas id="mycanvas" width="200px" height="200px"></canvas>    
</body>
<script>
    $(document).ready(function(){
        var canvas=$("#mycanvas");
        var context=canvas.get(0).getContext("2d");
        context.fillRect(0,0,150,150);//绘制矩形
    });
</script>
</html>